package edu.chl.hajo.shop.core;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * 
 * Shop is a container for other containers
 * NOTE: Uses Java 1.7
 *
 * @author hajo
 */
public class JPAShop implements IShop {
    
    String pu = "shop_pu";

    private  IProductCatalogue productCatalogue = ProductCatalogue.newInstance(pu);
    private  ICustomerRegistry customerRegistry = CustomerRegistry.newInstance(pu);
    private  IOrderBook orderBook = OrderBook.newInstance(pu);

    public JPAShop() {
        Logger.getAnonymousLogger().log(Level.INFO, "Shop alive {0}", this.hashCode());
    }

    JPAShop(String pu) {
       productCatalogue = ProductCatalogue.newInstance(pu);
      customerRegistry = CustomerRegistry.newInstance(pu);
       orderBook = OrderBook.newInstance(pu);
    }

    @Override
    public ICustomerRegistry getCustomerRegistry() {
        return customerRegistry;
    }

    @Override
    public IOrderBook getOrderBook() {
        return orderBook;
    }

    @Override
    public IProductCatalogue getProductCatalogue() {
        return productCatalogue;
    }
}
